package com.lvyq.myplayer.util;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * 文件描述：URLProviderUtils
 * 作者：lvyq
 * 创建时间：2025-02-19
 * 修改时间：2025-02-19
 */
public class URLProviderUtils {

    //192.168.200.73
    public static final String DoMain ="http://192.168.200.178:8080/myplayer/";

    public static final String HomeLstUrl=DoMain+"home/list?pageNum=num&pageSize=size";

    public static final String YueDanUrl=DoMain+"yuedan/list?pageNum=num&pageSize=size";

    public static final String VBangUrl=DoMain+"song/list?pageNum=num&pageSize=size";

    public static final String MvLstUrl=DoMain+"mv/list?pageNum=num&pageSize=size&code=area";

    public static final String AreaUrl = DoMain+"mv/areaLst";

    //歌手-歌曲信息
    public static final String SingerSongPageUrl=DoMain+"song/page?singerId=sid&pageNum=num&pageSize=size";

    public static final String SingerSongPageByAlbumIdUrl=DoMain+"song/page?singerId=sid&albumId=aid&pageNum=num&pageSize=size";

    //歌手-专辑
    public static final String SingerAlbumPageUrl=DoMain+"album/list?singerId=sid&pageNum=num&pageSize=size";
    //歌手-视频
    public static final String SingerVideoPageUrl=DoMain+"video/list?singer=singerName";
    public static final String reUpdVideo=DoMain+"video/reUpdVideo?id=videoId";

    //搜索
    public  static  final   String SearchUrl = DoMain+"song/search/VAL";

    public static final String CheckVersionUrl = DoMain+"song/checkVersion/versionCode";


    public static final String RankingUrl = DoMain+"ranking/list?type=TYPE&del=0";
    public static final String RankingItemUrl = DoMain+"ranking/list?rankingId=RANKING_ID";


    public  static String getHomeLst(Integer pageNum,Integer pageSize ){
        Integer newPageNum = (pageNum-1)/5;
        //接口从1开始，这里加1
        newPageNum=newPageNum+1;
        String replace = HomeLstUrl.replace("num", newPageNum.toString()).replace("size", pageSize.toString());
        System.out.println("replace>>>"+replace);
        return replace;
    }

    /**
     * 乐单列表数据
     * @param offset
     * @param i
     * @return
     */
    @NotNull
    public static String getYueDanLst(Integer pageNum,Integer pageSize) {
        Integer newPageNum = (pageNum-1)/5;
        //接口从1开始，这里加1
        newPageNum=newPageNum+1;
        String replace = YueDanUrl.replace("num", newPageNum.toString()).replace("size", pageSize.toString());
        System.out.println("replace>>>"+replace);
        return replace;
    }

    /**
     * MV-区域数据
     * @param pageNum
     * @param pageSize
     * @return
     */
    public static String getAreaLst() {
        return AreaUrl;
    }

    @NotNull
    public static String getMvLst( String code, Integer pageNum,Integer pageSize) {
        Integer newPageNum = (pageNum-1)/5;
        //接口从1开始，这里加1
        newPageNum=newPageNum+1;
        String replace = MvLstUrl
                .replace("num", newPageNum.toString())
                .replace("size", pageSize.toString())
                .replace("area",code);
        System.out.println("MV界面>>>"+replace);

        return replace;
    }

    @NotNull
    public static String getVbangLst(Integer pageNum,Integer pageSize) {
        Integer newPageNum = (pageNum-1)/10;
        //接口从1开始，这里加1
        newPageNum=newPageNum+1;
        String replace = VBangUrl
                .replace("num", newPageNum.toString())
                .replace("size", pageSize.toString());

        return replace;
    }

    /**
     * 歌手-歌曲信息
     * @param singerId
     * @param newPageNum
     * @param pageSize
     * @return
     */

    public static String getSingerSongPage(Integer singerId,Integer newPageNum,Integer pageSize) {
        String replace = SingerSongPageUrl
                .replace("num", newPageNum.toString())
                .replace("size", pageSize.toString())
                .replace("sid",singerId.toString());

        return replace;
    }

    /**
     * 获取歌曲集合根据songid
     * @return
     */
    public static String getSingerSongPage100BySongId(String albumId,Integer singerId) {
        String replace = SingerSongPageByAlbumIdUrl
                .replace("num", "1")
                .replace("size","100")
                .replace("sid",singerId.toString())
                .replace("aid",albumId);

        return replace;
    }

    /**
     * 歌手-专辑信息
     * @param singerId
     * @return
     */
    public static String getSingerAlbumList(Integer singerId) {
        String replace = SingerAlbumPageUrl
                .replace("sid",singerId.toString());

        return replace;
    }

    @NotNull
    public static String getSingerVideoList(String singerName) {
        String replace = SingerVideoPageUrl
                .replace("singerName",singerName);

        return replace;
    }
    public static String reUpdVideo(Integer videoId) {
        String replace = reUpdVideo
                .replace("videoId", videoId.toString());
        return replace;
    }

    public static String search(String searchVal) {
        String replace = SearchUrl
                .replace("VAL", searchVal);
        return replace;
    }

    /**
     * 检测新版本
     * @param versionCode
     * @return
     */
    public static String checkVersion(Long versionCode) {
        String replace = CheckVersionUrl.replace("versionCode", versionCode.toString());
        return replace;
    }

    public static String getRankingList(@Nullable Integer type) {
        String replace = RankingUrl.replace("TYPE", type.toString());
        return replace;
    }
    public static String getRankingItemListUrl(@Nullable Integer rankingId) {
        String replace = RankingUrl.replace("RANKING_ID", rankingId.toString());
        return replace;
    }

}
